package managers;

import java.util.ArrayList;

import finobjects.Transaction;

public class TransactionManager {

	public static ArrayList<Transaction> transactions;
	private static boolean initialized = false;

	public static ArrayList<Transaction> getTransactionsByAccountNumber (int accNum) {
		init();
		ArrayList<Transaction> out = new ArrayList<Transaction>();
		for(Transaction t : TransactionManager.transactions) {
			if(t.getAccountNumber() == accNum) {
				out.add(t);
			}
		}

		return out;
	}


	public static ArrayList<Transaction> getTransactionsByBinNumber (int binNum) {
		init();
		ArrayList<Transaction> out = new ArrayList<Transaction>();
		for(Transaction t : TransactionManager.transactions) {
			if(t.getBinNumber() == binNum) {
				out.add(t);
			}
		}

		return out;
	}


	private static void init() {
		if(!initialized) {
			transactions = new ArrayList<Transaction>();
			initialized = true;
		}
	}

}
